/*
 * NotesDialog.java
 *
 * Created on September 8, 2006, 9:43 PM
 */
package com.floreantpos.ui.dialog;

import com.floreantpos.main.Application;

/**
 *
 * @author MShahriar
 */
public class NotesDialog extends POSDialog {

  /**
   * Creates new form NotesDialog
   */
  public NotesDialog(java.awt.Frame parent, boolean modal) {
    super(parent, modal);
    initComponents();
  }

  private void initComponents() {
    titlePanel = new com.floreantpos.ui.TitlePanel();
    transparentPanel1 = new com.floreantpos.swing.TransparentPanel();
    posButton1 = new com.floreantpos.swing.PosButton();
    posButton2 = new com.floreantpos.swing.PosButton();
    noteView = new com.floreantpos.ui.views.NoteView();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    getContentPane().add(titlePanel, java.awt.BorderLayout.NORTH);

    posButton1.setText(com.floreantpos.POSConstants.FINISH);
    posButton1.setPreferredSize(new java.awt.Dimension(120, 50));
    posButton1.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        doFinish(evt);
      }
    });

    transparentPanel1.add(posButton1);

    posButton2.setText(com.floreantpos.POSConstants.CANCEL);
    posButton2.setPreferredSize(new java.awt.Dimension(120, 50));
    posButton2.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
        doCancel(evt);
      }
    });

    transparentPanel1.add(posButton2);

    getContentPane().add(transparentPanel1, java.awt.BorderLayout.SOUTH);

    noteView.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
    getContentPane().add(noteView, java.awt.BorderLayout.CENTER);

    pack();
  }

  private void doCancel(java.awt.event.ActionEvent evt) {
    setCanceled(true);
    dispose();
  }

  private void doFinish(java.awt.event.ActionEvent evt) {
    setCanceled(false);
    dispose();
  }

  @Override
  public void setTitle(String title) {
    super.setTitle(Application.getTitle());

    titlePanel.setTitle(title);
  }

  /**
   * @param args the command line arguments
   */
  public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
      public void run() {
        new NotesDialog(new javax.swing.JFrame(), true).setVisible(true);
      }
    });
  }

  private com.floreantpos.ui.views.NoteView noteView;
  private com.floreantpos.swing.PosButton posButton1;
  private com.floreantpos.swing.PosButton posButton2;
  private com.floreantpos.ui.TitlePanel titlePanel;
  private com.floreantpos.swing.TransparentPanel transparentPanel1;

  public String getNote() {
    return noteView.getNote();
  }

  public void setNote(String noteText) {
    noteView.setNote(noteText);
  }

}
